﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FisheryPlatform.Entity;
using FisheryPlatform.Bussiness.Post;

namespace FisheryPlatform.Web.WWW.Post
{
    public partial class Details : System.Web.UI.Page
    {
        protected PostMixEntity PostInfo = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            long postId = 0;
            long.TryParse(Request.QueryString["postId"], out postId);
            PostInfo = PostManager.GetByPostId(postId);
            if (PostInfo.Post.PostId == 0)
            {
                Response.End();
            }
            menuStyle.Title = HttpUtility.HtmlEncode(PostInfo.Post.Title.Trim()) + "|涝洲渔业";
        }

        protected string GetTags(string metaAttr)
        {
            #region
            var result = "";
            foreach (var term in PostInfo.Terms)
            {
                if (term.Taxonomy == TermTaxonomyEnum.Tag)
                {
                    result += term.Name + ",";
                }
            }
            return metaAttr + "=\"" + HttpUtility.HtmlEncode(result.TrimEnd(',')) + "\"";
            #endregion
        }
    }
}